<!DOCTYPE html>
<html>
<head>
<title>倍率设置</title>
<meta charset="utf-8">
<meta name="viewport"
	content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no" />

<script type="text/javascript"
	src="//cdn.css.net/libs/jquery/2.2.3/jquery.min.js"></script>
<script type="text/javascript" src="${base}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${base}/assets/style/js/switch.js"></script>
<link rel="stylesheet" href="${base}/assets/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="${base}/assets/layui/css/layui.css">
<link rel="stylesheet" href="${base}/assets/style/css/style.css">
<link rel="stylesheet" href="${base}/assets/style/css/switch.css">
</head>
<body>
	<div class="container-fluid">
		<div class="row" style="height:30px;"></div>
		<div class="row">
			<div class="col-xs-12">
				<div class="form-horizontal">
					<div class="form-group">
						<label class="col-xs-4 control-label">第一名：</label>
						<div class="col-xs-5">
							<input id="key1" class="form-control input-small input-sm"
								type="number" value="${key1!0}">
						</div>
						<input id="btn1" class="sub-btn layui-btn layui-btn-small"
							type="button" value="保存">
					</div>
					<div class="form-group">
						<label class="col-xs-4 control-label">第二名：</label>
						<div class="col-xs-5">
							<input id="key2" class="form-control input-small input-sm"
								type="number" value="${key2!}">
						</div>
						<input id="btn2" class="sub-btn layui-btn layui-btn-small"
							type="button" value="保存">
					</div>
					<div class="form-group">
						<label class="col-xs-4 control-label">第三名：</label>
						<div class="col-xs-5">
							<input id="key3" class="form-control input-small input-sm"
								type="number" value="${key3!}">
						</div>
						<input id="btn3" class="sub-btn layui-btn layui-btn-small"
							type="button" value="保存">
					</div>
					<div class="form-group">
						<label class="col-xs-4 control-label">第四名：</label>
						<div class="col-xs-5">
							<input id="key4" class="form-control input-small input-sm"
								type="number" value="${key4!}">
						</div>
						<input id="btn4" class="sub-btn layui-btn layui-btn-small"
							type="button" value="保存">
					</div>
					<div class="form-group">
						<label class="col-xs-4 control-label">第五名：</label>
						<div class="col-xs-5">
							<input id="key5" class="form-control input-small input-sm"
								type="number" value="${key5!}">
						</div>
						<input id="btn5" class="sub-btn layui-btn layui-btn-small"
							type="button" value="保存">
					</div>
					<div class="form-group">
						<div class="col-xs-offset-4 col-xs-8">
							<div>
								<label style="color:red">注：余额不足时自动关闭</label>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-4 control-label">自动发奖：</label>
						<div class="col-xs-5">
							<div class="switch">
								<#if key10=0>
								<input id="switch" type="checkbox" checked="checked"/>
								<#else>
								<input id="switch" type="checkbox" />
								</#if>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<nav class="navbar navbar-default navbar-fixed-bottom">
			<div class="btn-group btn-group-justified">
				<div class="btn-group">
					<a class="btn btn-default" href="adm">比率设置</a>
				</div>
				<div class="btn-group">
					<a class="btn btn-default" href="setrate">倍率设置</a>
				</div>
				<div class="btn-group">
					<a class="btn btn-default" href="setagent">代理设置</a>
				</div>
				<div class="btn-group">
					<a class="btn btn-default" href="record">消费记录</a>
				</div>
			</div>
		</nav>
	</div>
	<script type="text/javascript">
		jQuery(document).ready(function() {
			$(".sub-btn").on('click', function() {
				var mkey = $(this).attr("id").substr(3);
				var mvalue = $("#key" + mkey).val();
				$.post("savevalue.do", {
					'mkey' : mkey,
					'mvalue' : mvalue
				}, function(data) {
					layer.open({
						content : '<div>保存成功！</div>',
						time : 2
					});
				});
			});
			$("#switch").bootstrapSwitch();
			$("#switch").on('switchChange.bootstrapSwitch', function(event, state) {
				$.post("savevalue.do", {
					'mkey' : 10,
					'mvalue' : state?0:1
				}, function(data) {
					console.log(state,'保存成功！');
				});
			});
		});
	</script>
</body>
</html>
